package utils;

import gis.views.beans.PointXY;

/**
 * Created by Administrator on 2017/5/3.
 */

public class MeasureArea {
    public  static double LEFT= 270000;
    public static double TOP = 5100000;
    public static double RIGHT = 39000;
    public static double DOWN = 4980000;

    public static double area(PointXY[] pxy)
    {
        double x1=0,x2=0,y1=0,y2=0,sum=0,area = 0;
        int size = pxy.length;
        int i = 0,j=0;
        for (;i<size;i++)
        {
            x1 = pxy[i].getX();
            y1 = pxy[i].getY();
            j = (i+1)%size;
            x2 = pxy[j].getX();
            y2 = pxy[j].getY();
            sum += x1*y2-x2*y1;
        }

        area = Math.abs(sum)/2;
        return area;
    }
}
